package com.songlanyun.modules.studying.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.songlanyun.common.drive.RootEntity;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@TableName("yxt_studying")
public class Studying extends RootEntity<Long, Studying> implements Serializable {

    /**
     * id
     */
    @TableId
    private Long id;
    /**
     * 课程名称
     */
    @NotEmpty(message = "课程名称不能为空")
    private String studyName;
    /**
     * 课程封面
     */
    @NotEmpty(message = "课程封面不能为空")
    private String studyUrl;
    /**
     * 讲师名字
     */
    private String studyTeacher;
    /**
     * 所属分类
     */
    @NotNull(message = "所属分类不能为空")
    private Long studyType;
    /**
     * 课程详情
     */
    @NotEmpty(message = "课程详情不能为空")
    private String studyContent;
    /**
     * vip专享
     */
    @NotNull(message = "是否vip专享不能为空")
    private Boolean hasVip;
    /**
     * 序号
     */
    @NotNull(message = "序号不能为空")
    private Integer hasOrder;
    /**
     * 状态 0下架 1上架 默认1
     */
    private Boolean hasStatus;
    /**
     * 是否推荐0否1是默认0
     */
    private Boolean hasHeader;
    /**
     *
     */
    private Long createBy;
    /**
     *
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    /**
     *
     */
    private Long updateBy;
    /**
     *
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    /**
     * 是否删除0否1是默认0
     */
    @TableLogic(value = "0",delval = "1")
    private Boolean hasDelete;


    /**
     * 分类名称
     */
    @TableField(exist = false)
    private String studyTypeName;
    /**
     * 课程章节
     */
    @TableField(exist = false)
    private Integer studyingCount;
    /**
     * 点击量
     */
    @TableField(exist = false)
    private Long studyingClick;
    /**
     * 课程时长
     */
    @TableField(exist = false)
    private BigDecimal studyingLength;
    @Override
    public Long getIdentity() {
        return getId();
    }
}
